from django.db import models
from apps.common.base.models import BaseModel
from apps.merchant.item.models import Item
from apps.merchant.sku.models import Sku
from apps.user.models import UserModel

class ShopCart(BaseModel):

    scene = (
        ('generay', "普通商品"),
        ('giftSection', "大礼包"),
        ('shopItem', "商户商品")
    )
        
    scene = models.CharField("场景", max_length=100, choices=scene, default='generay')
    user = models.ForeignKey(UserModel, related_name='user_shopCart', verbose_name='用户', on_delete=models.SET_NULL, null=True, blank=True, db_constraint=False)
    item = models.ForeignKey(Item, related_name="item_shopCart", verbose_name='商品', on_delete=models.SET_NULL, null=True,
                             blank=True, db_constraint=False)
    sku = models.ForeignKey(Sku, related_name="sku_shopCart", verbose_name='sku', on_delete=models.SET_NULL, null=True,
                             blank=True, db_constraint=False)
    specValues = models.CharField("规格值", max_length=200, blank=True)
    payCount = models.IntegerField("数量", blank=True, default=1)

    class Meta:
        verbose_name = 'ShopCart'
        verbose_name_plural = verbose_name
